import request from '@/utils/request.js'


// 登录接口
export const userLoginService = ({username, password}) =>
    request.post('/security/login/', {username, password})

// 查询人员权限信息
export const getManagerPowerInfo = () => request.get('/applet/management/manager/power/getInfo')

//查询人员信息
export const listPageManager = (data) =>
    request.get(`/user/users/`, {
        params: {
            "page": data.page,
            "size": data.size,
            "status": data.status,
            "nickname": data.nickname,
            "phone":data.phone,
        }
    })

// 新增用户
export const addLoserManager = (data) =>
    request.post('/user/users/', data)

// 修改用户状态
export const updateLoserManager = (id,is_active) =>
    request.put(`/user/updateUserStatusView/`, {
       data:{
        "id": id,
        "status":is_active
       }
    })

// 根据用户id查询对应的角色信息
export const getRoleByUserId = (userId) =>
    request.get(`/user/role/getRoleByUserId/${userId}`,)

// 修改用户角色
export const updateUserRole = (userId,roleIds) =>
    request.put(`/user/role/updateUserRole/`, {
        "userId": userId,
        "roleIds":roleIds
    })

// 删除用户
export const deleteLoserManager = (ids) =>
    request.delete('/user/deleteUserView/', {
        data: {
            "ids":ids
        }
    })

// 查询角色列表
export const listRole = () =>
    request.get('/user/role/listAllRole/')

// 查询人员菜单路由路径
export const getRouters = () =>
    request.get('/security/getRouters/')


